package com.software.bean;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 *
 * </p>
 *
 * @author wyj
 * @since 2024-04-04
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("tb_order")
public class OrderBean implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @TableField("order_no")
    private String orderNo;

    /**
     * 产品表
     */
    @TableField("product_id")
    private Integer productId;

    @TableField("status")
    private Integer status;

    @TableField("order_price")
    private Double orderPrice;

    /**
     * 用户
     */
    @TableField("buyer_id")
    private Integer buyerId;

    /**
     * 收货地址
     */
    @TableField("address_id")
    private Integer addressId;

    /**
     * 单号
     */
    @TableField("delivery_no")
    private String deliveryNo;

    /**
     * 下单时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("create_time")
    private Date createTime;

    /**
     * 发货
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("send_time")
    private Date sendTime;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("end_time")
    private Date endTime;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("close_time")
    private Date closeTime;

    @TableField(exist = false)
    private CustomerInfoBean buyerBean; //买家信息

    @TableField(exist = false)
    private ProductBean productBean;
    @TableField(exist = false)
    private CustomerAddressBean addressBean;
    @TableField("seller_id")
    private Integer sellerId;
    @TableField(exist = false)
    private CustomerInfoBean sellBean; //卖家信息

    @TableField("order_desc")
    private String orderDesc;
    @TableField("pay_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date payTime;
}
